#!/usr/bin/perl
# 
# Exercise 11.7
# 
# Write a subroutine that, given two strings, prints them out one over the other, but 
# with line breaks (similar to the stride program output). Use this subroutine to print 
# out the strings from Example 11-7.
#

use strict;
use warnings;

my $str1 = '# Write a subroutine that, given two strings, prints them out one over the other, but  '; 
my $str2 = '# with line breaks (similar to the stride program output). Use this subroutine to print'; 

outputstrings(25, $str1, $str2);

exit;

# We'll assume the two strings are of equal length.  (How would you handle strings of
# differing lengths?
sub outputstrings {
	my($linelength, $str1, $str2) = @_;

	my $strlength = length $str1;

	#for( my $i=0; $i < ($strlength - $linelength) ; $i += $linelength) {
	for( my $i=0; $i < $strlength ; $i += $linelength) {
		print substr($str1, $i, $linelength),"\n";
		print substr($str2, $i, $linelength),"\n";
		print "\n";
	}
}
